package com.chinasoft.ssm.service.impl;

import com.chinasoft.ssm.mapper.AccountLogMapper;
import com.chinasoft.ssm.pojo.AccountLog;
import com.chinasoft.ssm.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class LogServiceImpl implements LogService {
    @Autowired
    AccountLogMapper mapper;

    @Override
    public void save(String from, String to, Double money, boolean flag) {
        AccountLog al = new AccountLog(null, "从 " + from + "给 " + to + "转账 " + money + " 钱, 是否成功: " +flag, new Date());
        Integer ret = mapper.insert(al);
        if (ret != 1) {
            throw new RuntimeException("插入AccountLog表失败");
        }
    }
}
